CEO function
A program can register only one CEO function, but XgrProcessMessages() , sends every message it processes to that function, no matter what the message contains. Furthermore, XgrProcessMessages() sends each message to the CEO function before any other, and the CEO can cancel the message to prevent its propogation to other functions.

Programs call XgrSetCEO (func) to set the address of the CEO function to func . An address of 0 means no CEO function is active. Only one CEO function can be active at a time, so each time XgrSetCEO(func) is called, the previous CEO function is replaced by func .

When messages are processed by XgrProcessMessages() , they are sent to the CEO function, then to the window function appropriate to the window/grid and message. This sequence is initiated when programs call XgrProcessMessages() .

XgrProcessMessages() checks to see if a CEO function exists. If it does, it calls the CEO function, passing it the message arguments, plus 0 in r0 and a duplicate of the window or grid argument in r1 . The CEO can examine the message and take whatever action it needs to perform its function.

The CEO function can return -1 in r0 to cancel the message. When XgrProcessMessages() finds the CEO function returned -1 in r0 , it cancels the message and returns without calling any window functions it otherwise would have called to process the message.